﻿using AuthorityManagement.IUserService;
using AuthorityManagement.Model;
using AuthorityManagement.Model.Dto.FileDto;
using Mapster;
using Microsoft.AspNetCore.Mvc;
using SqlSugar;
using System;
using System.Threading.Tasks;

namespace AuthorityManagement.UserService
{
    public class UserService : IUserServiceTest
    {
        private readonly ISqlSugarClient _Db;
        public UserService(ISqlSugarClient db)
        {
            _Db = db;
        }
        public Task<dynamic> CreateFile([FromBody] FileCrInput input)
        {
               var data = input.Adapt<File>();
                data.Id = Guid.NewGuid().ToString();
                var isOk = _Db.Insertable(data).ExecuteCommand();
                if (!(isOk > 0))
                {
                return null;
                    //return new { Message = "新建文件失败！", Success = false };
                }
                else
                {
                return null;
                //return new { Message = "新建文件成功！", Success = true };
            }

           
        }
    }
}
